#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s1[205],s2[205];
	cin.getline(s1,200);
	cin.getline(s2,200);
	
	if (strstr (s1,s2)!=NULL)
	{
		cout<<s2<<' '<<"is substring of"<<' '<<s1<<endl;
	}
	else 
	{
		if (strstr (s2,s1)!=NULL)
		{
			cout<<s1<<' '<<"is substring of"<<' '<<s2<<endl;
		}
		else cout<<"No substring"<<endl;
	}
	
	return 0;
}